var top_a_eles = document.querySelectorAll(".header-top-ul>li>a");
var top_em_eles = document.querySelectorAll(".header-top-ul>li>em");
var bottom_span_eles = document.querySelectorAll(".header-bottom-ul>li>a>span");
var none_box_ele = document.getElementsByClassName('header-none-box')[0];
var bottom_ele = document.getElementsByClassName('header-bottom')[0];


for (i = 0; i < top_a_eles.length; i++) {
    top_a_eles[0].className = "top-a-ele-click";
    top_em_eles[0].style.display = 'block';

    top_a_eles[i].onclick = function () {
        for (j = 0; j < top_a_eles.length; j++) {
            top_a_eles[j].className = "";
            top_em_eles[j].style.display = 'none';
        }
        this.className = "top-a-ele-click";
        this.nextSibling.style.display = "block";

        if (this.id == 'findMusic') {
            none_box_ele.style.display = 'none';
            bottom_ele.style.display = 'block';
        } else {
            none_box_ele.style.display = 'block';
            bottom_ele.style.display = 'none';
        }

    }
}

for (i = 0; i < bottom_span_eles.length; i++) {
    bottom_span_eles[0].className = "bottom-span-click";
    bottom_span_eles[i].onclick = function () {
        for (j = 0; j < bottom_span_eles.length; j++) {
            bottom_span_eles[j].className = "";
        }
        this.className = "bottom-span-click";
    }
}

// 引入主体资源文件
$("#findMusic").click(function () {
    $.get('./findMusic.html', function (data) {
        $('.index-body').html(data);
    }, 'text');
});



$('#myMusic').click(function () {
    $.get('./myMusic.html', function (data) {
        $('.index-body').html(data);
    }, 'text');
});


$('#follow').click(function () {
    $.get('./follow.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#download').click(function () {
    $.get('./download.html', function (data) {
        $('.index-body').html(data);
    });
});

// ======================================
$('#intro').click(function () {
    $.get('./findMusic.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#ranking').click(function () {
    $.get('./intro_ranking.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#songList').click(function () {
    $.get('./intro_songList.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#moreSong').click(function () {
    $.get('./intro_songList.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#radio').click(function () {
    $.get('./intro_radio.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#singer').click(function () {
    $.get('./intro_singer.html', function (data) {
        $('.index-body').html(data);
    });
});

$('#newDisk').click(function () {
    $.get('./intro_newDisk.html', function (data) {
        $('.index-body').html(data);
    });
});